Method of color palette coding applicable to electronic device and electronic device using the same

ABSTRACT

The disclosure is directed to a method of color palette coding and an electronic device using the same method. The proposed method would include not limited to encoding, by using a processor, a bit stream to represent a color of a coding unit and storing the bit stream in a storage medium or transmitting the bit stream. The bit stream would include not limited to a binary bit representing a run flag, a N binary bit sequence representing up to 2 N  major colors in a coding unit with each of the possible values of the N binary bit sequence representing an unique major color index of N major color indices, and a M binary bit sequence representing up to 2 M  extended colors with each of the possible values of the M binary bit sequence representing an unique extended color index of M extended color indices.

CROSS REFERENCE TO RELATED APPLICATION

This application is a divisional application of and claims the prioritybenefit of U.S. application Ser. No. 14/875,697, filed on Oct. 6, 2015,now allowed, which claims the priority benefit of U.S. provisionalapplication Ser. No. 62/060,015, filed on Oct. 6, 2014. The entirety ofeach of the above-mentioned patent applications is hereby incorporatedby reference herein and made a part of specification.

TECHNICAL FIELD

The present disclosure is directed to a method of color palette codingapplicable to an electronic device and an electronic device using thesame method.

BACKGROUND

Screen contents of videos may contain sharp edges of the objects,background with simple colors, many texts, fonts, and thin lines. Screencontents of videos that are artificially generated or have beenprocessed could be quite different in characteristics relative tocontents of videos which are naturally captured by a camera as suchvideos may contains rich colors and complex shapes. Consequently,palette coding was proposed to encode and decode screen contentsefficiently. A major color table with a limited and fixed size as wellas a coded index map could be signaled to a decoder. When thequantization parameter (QP) is high or is under a low bit rate codingcondition, the major color able would usually contain all the colors ina current coding unit (CU).

The major color table could be generated and signaled as a dictionary, acode book or a look up table for reference. The major color table may beincludes all colors in the current CU. Since there is a limitation forthe size of the major color table, colors not selected into the majorcolor table will be represented by escape colors. Colors that are notcovered by the major color table would be signaled as escape colors.

In a conventional palette coding scheme, an escape color pixel could besignaled with a mode flag plus a last index in major color table alongwith 24 bits YUV/RGB color sample values. However, the limited and fixedsize of major color table doesn't always work well when the QP is lowfor high quality coding and lossless coding. In general, when low QPvalue or lossless coding is implemented, the occurrence of escape colorswould be quite high. However, if escape colors would appear many timesin a CU, the frequent occurrences of escape colors could make thecurrent signaling scheme very inefficient. The technical details of theaforementioned predicament are further illustrated in FIG. 1 and FIG. 2and explained in their corresponding written descriptions.

FIG. 1 illustrates a general method color palette coding by using athree index coding mode. In step S101, pixels of a coding block 101would be analyzed in terms of various colors and the probabilities oftheir occurrences. In detail, FIG. 1 shows a color sample which includesnot limited to 16 pixels, and the colors represented are red (R), pink(Pk), blue (B), light blue (LB), green (G), yellow (Y), and black (Bk).The occurrences of these colors are compiled in a manner similar to ahistogram 102. In the example of FIG. 1, the occurrences for R, P, B,LB, G, Y, and BK are 4, 3, 3, 2, 2, 1, and 1 respectively.

In step S102, quantization would be performed to translate from thehistogram into a major color index table 103 based on the order of theprobability of their occurrences. Afterwards, the color of a pixel wouldsubsequently be referred to by its index. In the example of FIG. 1,index number 0 would refer to the color red (R), index number 1 wouldrefer to the color blue (B), index number 2 would refer to the colorgreen (G), and so forth. In step S103, the colors of each pixel of thecolor sample 101 would be represented by an index map 104 which could bestored temporarily in a video buffer, saved permanently in a disk drive,or transmitted to a video driver to be shown in a video display.

FIG. 2 illustrates a general method color palette coding by using athree index coding mode through an encoded syntax. In order to encodethe colors of a color sample 101, a syntax would be use to represent thecolors of the color sample 101. In the sample of FIG. 2, the syntax mayinclude not limited to a copy run mode flag (e.g., 210), a major colorindex (e.g., 211), and optionally an original color value (e.g., 212)only if the color to be represented is an escape color which is not oneof the colors listed in the major color table 220. For example, assumingthat the major color table is 5 bits, if the color of a pixel is orange(0), it would be index 0 of the major color table 220 represented by thebinary sequence of ‘00000’; if the color of a pixel is blue (B), itwould be indexed as 1 represented by the binary sequence of ‘00001’; andso forth.

The steps of palate coding of FIG. 2 would be implemented as follows. Instep S200, the copy left run mode or the copy above run mode would bedetermined according to the binary value of the copy run mode flag 210.In step S202, assuming that the copy above run mode is to beimplemented, then the copy run mode flag 210 would be set accordinglywith an associated run value. Otherwise, in step S201, assuming that thecopy left run mode is to be implemented, then copy run mode flag 210would set as a copy left run mode. The syntax would then include notlimited to a major color index with an associated run value if the colorto be represented can be exactly represented by the major color table220. In other words, the color to be represented exactly matches one ofthe colors of the major color table 220; otherwise, if the color cannotbe accurately represented by the major color table 200, the color wouldbe represented as an escape color. In step S203, assuming that the coloris an escape color, the syntax would include not limited to the (last)index 211 of the major color table 220 (e.g., the color “escape” ofindex 31) and an original color value 212. In the same of FIG. 2,assuming that E1 is the color grey which is an escape color, the syntaxwould include not limited to the copy run mode flag 210 set as ‘0’, themajor color index 211 set as the value 31 or ‘11111’, the original colorvalue 212 could be set as ‘1111111 1111111 1111111’ as an example.However, the disclosure does not limit the representation of an originalcolor to be 24 bits nor the exact binary sequences.

If a high resolution color sample is to be encoded, many color sampleswould be slightly different from the major colors especially for highrate coding conditions such that many color samples could not beaccurately represented. If many escape color pixels have to occur morethan once in a color sample, it can be seen from FIG. 1 and FIG. 2 thata coding syntax cannot be efficiently encoded, since the length of abinary sequence to represent an original color value 212 is much longerthan the length of a binary sequence to represent a major color index.Therefore, an alternative method of color palette coding and anelectronic device using the same method from the currently establishedmethod could be proposed.

SUMMARY OF THE DISCLOSURE

Accordingly, the disclosure is directed to a method of color palettecoding applicable to an electronic device and an electronic device usingthe same method.

In one of the exemplary embodiments, the present disclosure is directedto a method of color palette coding applicable to an electronic device,the method would include not limited to: encoding, by using a processor,a bit stream to represent a color of a coding unit and storing the bitstream in a storage medium or transmitting the bit stream. The bitstream would include not limited to a binary bit representing a runflag, a N binary bit sequence representing up to 2 major colors in acoding unit with each of the possible values of the N binary bitsequence representing an unique major color index of N major colorindices, and a M binary bit sequence representing up to 2^(M) extendedcolors which are not the major colors and appears less frequently thanthe major colors in the coding unit with each of the possible values ofthe M binary bit sequence representing an unique extended color index ofM extended color indices.

In one of the exemplary embodiment, the present disclosure is directedto an electronic device which includes not limited to a storage mediumand a processor coupled to the storage medium. The processor isconfigured at least for: encoding a bit stream to represent a color andstoring the bit stream in the storage medium or transmitting the bitstream. The bit stream would include not limited to a binary bitrepresenting a run flag, a N binary bit sequence representing up to2^(N) major colors in a coding unit with each of the possible values ofthe N binary bit sequence representing an unique major color index of Nmajor color indices, and a M binary bit sequence representing up to2^(M) extended colors which are not the major colors and appears lessfrequently than the major colors in the coding unit with each of thepossible values of the M binary bit sequence representing an uniqueextended color index of M extended color indices.

In order to make the aforementioned features and advantages of thepresent disclosure comprehensible, exemplary embodiments accompaniedwith figures are described in detail below. It is to be understood thatboth the foregoing general description and the following detaileddescription are exemplary, and are intended to provide furtherexplanation of the disclosure as claimed.

It should be understood, however, that this summary may not contain allof the aspect and embodiments of the present disclosure and is thereforenot meant to be limiting or restrictive in any manner. Also the presentdisclosure would include improvements and modifications which areobvious to one skilled in the art.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings are included to provide a furtherunderstanding of the disclosure, and are incorporated in and constitutea part of this specification. The drawings illustrate embodiments of thedisclosure and, together with the description, serve to explain theprinciples of the disclosure.

FIG. 1 illustrates a general method color palette coding by using athree index coding mode.

FIG. 2 illustrates a general method color palette coding by using athree index coding mode through an encoded syntax.

FIG. 3 is an example to illustrate a concept of palette coding by usingmultiple color tables in accordance with the disclosure.

FIG. 4 illustrates a proposed method of color palette coding applicableto an electronic device in accordance with the disclosure.

FIG. 5 illustrates an exemplary electronic device which uses theproposed method of color palette coding applicable to an electronicdevice in accordance with the disclosure.

FIG. 6 illustrates an embodiment of generating multiple major colortables in accordance with a first exemplary embodiment of thedisclosure.

FIG. 7 illustrates splitting a major color table into multiple majorcolor tables in accordance with one of the exemplary embodiments of thedisclosure.

FIG. 8 illustrates a syntax of color palette coding in accordance with asecond exemplary embodiments of the disclosure.

FIG. 9 illustrates a detailed flow chart of color palette coding inaccordance with one of the exemplary embodiments of the disclosure.

FIG. 10 illustrates implementing pixel level alternative escape flag inaccordance with a third exemplary embodiment of the disclosure.

FIG. 11 illustrates a detailed flow chart of implementing pixel levelalternative escape flag in accordance with one of the exemplaryembodiments of the disclosure.

FIG. 12A illustrates an alternative embodiment of operating with pixellevel alternative escape flag in accordance with a fourth exemplaryembodiment of the disclosure.

FIG. 12B illustrates an example of operating with pixel levelalternative escape flag in accordance with a fourth exemplary embodimentof the disclosure.

FIG. 13 illustrates representing escape colors in alternative manners inaccordance with a fifth exemplary embodiment of the disclosure.

FIG. 14 illustrates an example of the fifth exemplary embodiment of thedisclosure.

FIG. 15 is a comprehensive flow chart illustrating the procedures of thefourth, fifth, and sixth exemplary embodiment of the disclosure.

FIG. 16 illustrates using a combination of an extended color table withan alternative implementation of representing escape colors inaccordance with the seventh exemplary embodiment of the disclosure.

FIG. 17 is a flow chart which illustrates the procedure of the seventhexemplary embodiment of the disclosure.

FIG. 18 illustrates escape color pixel prediction in accordance with theeighth exemplary embodiment of the disclosure.

FIG. 19 illustrates a decoding process of a coded syntax in accordancewith one of the exemplary embodiments of the disclosure.

DETAILED DESCRIPTION OF DISCLOSED EMBODIMENTS

Reference will now be made in detail to the present exemplaryembodiments of the disclosure, examples of which are illustrated in theaccompanying drawings. Wherever possible, the same reference numbers areused in the drawings and the description to refer to the same or likeparts.

With the rapid advancements of new technologies in networking,communication systems, electronic display, and digital computers, manyapplications may require a more efficient coding solution. This proposaldiscloses a method of color palette coding applicable to an electronicdevice and an electronic device using the same method to further enhancethe coding efficiency of a coding block or a coding unit which could bea part of or a complete digital image. The proposed method and device ofthe disclosure would reconstruct colors in a coding block according todifferent color tables for a screen content. Compared with the start ofthe art, the SCM (screen content test model) anchor with full frame IBCsearch range, the proposed method may at best achieve the total bitsaving rate saving up to 1.0% as test conditions would excludecategories of animations and naturally captured images. A sample of anexperimental test result is shown at a table below:

Bit- Bit- Bit- rate Bit-rate rate rate saving saving saving saving(Total) (Average) (Min) (Max) RGB, text & graphics with motion, 1.0%1.0% 0.3% 1.3% 1080 p RGB, text & graphics with motion, 0.2% 0.1% 0.0%0.4% 720 p RGB, mixed content, 1440 p 0.1% 0.2% 0.0% 0.3% RGB, mixedcontent, 1080 p 0.1% 0.1% 0.1% 0.1% RGB, Animation, 720 p 0.0% 0.0% 0.0%0.0% RGB, camera captured, 1080 p 0.0% 0.0% 0.0% 0.0% YUV, text &graphics with motion, 0.8% 0.8% 0.2% 1.6% 1080 p YUV, text & graphicswith motion, 0.1% 0.1% 0.0% 0.2% 720 p YUV, mixed content, 1440 p 0.1%0.1% 0.0% 0.3% YUV, mixed content, 1080 p 0.1% 0.1% 0.1% 0.1% YUV,Animation, 720 p 0.0% 0.0% 0.0% 0.0% YUV, camera captured, 1080 p 0.0%0.0% 0.0% 0.0% Enc Time [%] 103% Dec Time [%] 100%

For high quality videos, and large coding blocks may contain many colorsamples which could be slightly different from the major colors and thusthe major color table might need to be expanded. For example, toaccurately represent 256 colors, 8 bits are required. However, thiswould mean an increase of the size of a code word. Moreover, because notall colors would appear in a similar frequency, extending the size of amajor color table may result in inefficiency of a color palette codingscheme. To enhance the efficiency of a current color palette scheme asthe result of increasing video quality, multiple color tables could beimplemented.

FIG. 3 is an example to illustrate a concept of palette coding by usingmultiple color tables in accordance with the disclosure. According tothe conceptual diagram of FIG. 3, multiple color tables 301 302 303could be utilized. For example, for the color table 301, the colors red(R), blue (B), green (G), and yellow (Y) respectively correspond toindex 0, 1, 2, and 3 of the color table 301; for the color table 302,the colors black (Bk), white (W), navel blue (NB), and purple (P)respectively correspond to index 0, 1, 2, and 3 of the color table 302;and for the color table 303, the color neon green (NG), pink (Pk),orange (O), and brown (Br) respectively correspond to index 0, 1, 2, and3 of the color table 303. By using the color tables 301 302 303, acoding block 304 could be represented by a color index map 305. Forexample, the color upper left corner of the coding block is red whichcorresponds to the index 0 of the color table 301; the color lower rightcorner of the coding block is orange which corresponds to index 2 of thecolor table 303; and so forth. However, a mechanism is required in acode word syntax to distinguish among various color tables being use,and such mechanism would be proposed as a part of the disclosure.

FIG. 4 illustrates a proposed method of color palette coding applicableto an electronic device in accordance with the disclosure. In step S401,an electronic device would encode, by using a processing unit or aprocessor, a bit stream to represent a color of a coding unit. In stepS402, the bit stream could be stored in a temporary buffer or apermanent storage medium or transmitted to a video driver to bedisplayed. The bit stream may include a binary bit representing a runflag, a N binary bit sequence representing up to 2 to the Nth majorcolors in a coding unit with each of the possible values of the N binarybit sequence representing an unique major color index of N major colorindices, and a M binary bit sequence representing up to 2 to the Mthextended colors which are not the major colors and appears lessfrequently than the major colors in the coding unit with each of thepossible values of the M binary bit sequence representing an uniqueextended color index of M extended color indices.

Alternative to the embodiment of FIG. 4, each color of the N major colorindices and each color of the M extended color indices could be furthercoded into variable length representation. For example, a first color ofthe N major color indices which could be orange could be represented by2 bits while a second color of the N major color indices which could beblue could be represented by 3 bits and so forth. The same example mayapply for the extended color indices. For example, each color of the Nmajor color indices and each color of the M extended color indices wouldbe represented by unique values of a binary sequence such as accordingto Hoffman codes.

In one of the exemplary embodiments, an index of the N major colorindices would be used to refer to not a particular major color but toanother set of color table such as the aforementioned extended colors.

In one of the exemplary embodiments, an index of the M extended colorindices would be used to refer to not a particular extended color nor amajor color but an escape color. The bit stream may further include anescape color bit sequence representing the escape color in the case onlyif a color to be represented is not a major color not an extended colorbut a major color. The escape color bit sequence would likely be longerthan both the N binary bit sequence and the M binary bit sequence. Themajor color bit sequence could be represented by an original color valueof the escape color.

In one of the exemplary embodiments, the run flag is at least one bitthat indicates either a copy left mode or a copy above mode.

In one of the exemplary embodiments, the last of the N major colorindices refers to the extended colors. Similarly, the last of the Mextended color indices refers to the escape color.

In one of the exemplary embodiments, an index of the M extended colorindices may refer to a second set of extended colors which are neitherthe major colors nor the extended colors.

In one of the exemplary embodiments, another bit stream may include apixel level alternative escape flag, a second M binary bit sequencerepresenting up to 2 to the (M−1)th extended colors, and a secondoriginal color value to represent an escape color of the second codingunit.

In one of the exemplary embodiments, when the pixel level alternativeescape flag is a first value, the color of the second coding unit isrepresented by the M extended color indices, and when the pixel levelalternative escape flag is a second value, the color of the secondcoding unit is represented by the N major color indices.

In one of the exemplary embodiments, only when the run flag indicatesthe copy above mode, the pixel level alternative escape flag is thefirst value.

In one of the exemplary embodiments, a third bit stream may include athird binary bit indicating the copy above mode, a pixel levelalternative escape flag set to the second value, and a third originalcolor value to represent the third escape color.

In one of the exemplary embodiments, if the color of the third codingunit is not the third escape color, the third binary bit in the thirdbit stream may indicate the copy above mode; the pixel level alternativeescape flag set to the first value in the third bit stream; and a copyabove run value associated with the copy above mode may also beprovided.

In one of the exemplary embodiments, a fourth bit stream could representa color of a fourth coding unit. If the fourth color is a fourth escapecolor, the fourth bit stream may include a fourth binary bitrepresenting a run flag which indicates the copy above mode, a run valueassociated with the run flag, and a fourth original color value torepresent the fourth escape color. If the color of the fourth codingunit is not the fourth escape color, the fourth bit stream may otherwiseinclude the fourth binary bit representing the run flag which indicatesthe copy above mode, the run value associated with the run flag, and asecond M binary bit sequence representing up to 2 to the Mth extendedcolors.

In one of the exemplary embodiments, a fifth bit stream could be used torepresent a color of a fifth coding unit, and the fifth bit stream mayinclude not limited to a pixel level alternative escape flag. If thepixel level alternative escape flag is set as the second value, thefifth bit stream may further include a third N binary bit sequencerepresenting up to 2 to the Nth major colors in a coding unit with eachof the possible values of the N binary bit sequence representing anunique major color index of N major color indices except for a lastindex indicating an escape color.

In one of the exemplary embodiments, if the pixel level alternativeescape flag is set as the second value, the last index indicates one ofthe major colors, but if the pixel level alternative escape flag is setas active, the last index refers to one of the extended colors.

FIG. 5 illustrates an exemplary electronic device which uses theproposed method of color palette coding applicable to an electronicdevice in accordance with the disclosure. The exemplary electronicdevice may include not limited to a processing unit 501, a storagemedium 504, optionally a display driver 502, and optionally anelectronic display 503. The processing unit 502 is electrically coupledto the storage medium 504, the display driver 502, and the electronicdisplay 503. The storage medium 504 may could be a temporarily storagebuffer or a permanent storage or a combination of both. The storagemedium 504 may be a fixed or a movable device in any possible formsincluding non-transitory computer readable recording medium such as arandom access memory (RAM), a read-only memory (ROM), a flash memory orother similar devices, or a combination of the above-mentioned devices.The processing unit 501 is configured to process digital signals and toperform procedures of the proposed method of color palette coding asdescribed in the disclosure. The storage medium 504 may store softwareprograms used by the processing unit 501 as such as the above mentionedimages containing coding blocks or image samples for coding, variouscolor tables 504 a, color index maps, and so forth.

The processing unit 501 could be a form of a processor or a controllerimplemented by using programmable units such as a micro-processor, amicro-controller, digital signal processor (DSP) chips, afield-programmable gate array (FPGA), etc. The function of theprocessing unit 501 may also be implemented with separate electronicdevices or ICs, and functions performed by the processing unit 501 mayalso be implemented within the domains of either hardware or software.The processing unit may contain a hardware or software encoder 501 a toencode an image according to the proposed method of color palette codinginto a plurality of bit streams which would could either be saved intothe storage medium 504 or transmitted to a display driver 502 fordisplay. Upon receiving the bit streams, the display driver may containa hardware or a software decoder 502 a to decode the bit streams inorder to display decoded images in an electronic display 503. Thedisplay driver 502 may access a storage medium which could be either thestorage medium 504 or a local storage medium (not shown) to storesoftware programs used by the display driver 502 as such as the abovementioned images containing coding blocks or image samples for coding,various color tables 504 a, color index maps, and so forth.

FIG. 6˜FIG. 18 and their corresponding written descriptions serve toelucidate various exemplary embodiments in accordance with the proposedmethod of color palette coding applicable to an electronic device and anelectronic device using the same method.

FIG. 6 illustrates an embodiment of generating multiple major colortables in accordance with a first exemplary embodiment of thedisclosure. For the scenario of FIG. 6, a major color table 600containing 12 colors, namely, red (R), blue (B), green (G), yellow (Y),black (B), white (W), navy blue (NB), purple (P), neon green (NG) pink(Pk), orange (O), and brown (Br) could be splitted into multiple colortables 601 602 603. For example, the color table 601 may contain colorsthat occur the most frequently than colors of the color tables 602 and603. The color tables 602 and 603 could be extended color tables withthe colors in the color table 602 occurring more frequently than thecolors in the color table 603.

An algorithm that can be used to split a color table into multiple colortables could be accomplished by Rate-Distortion optimization check (RDOcheck). RDO is a check mechanism used for improving video quality invideo compression. It optimizes by acting as a video quality metric,measuring both the deviation from the source material and the bit costfor each possible decision outcome. By optimizing the amount ofdistortion or loss of video quality against the amount of data requiredto encode the video, the exactly split could be determined. The bitscould be mathematically measured by multiplying the bit cost by theLagrangian, a value representing the relationship between bit cost andquality for a particular quality level. Various deviations could bemeasured by mean squared error in order to maximize a video quality.

The size of each table could be decided by an encoder that perform RDOchecks. The encoder may need to consider additional N RDO checks (e.g.,{M-1, M-2, M-3, M-N} RDO checks) with various palette sizes in order toget the best size S. In this way, at least two tables could be obtainedwith one table equal size S and the other equal size M-S. An example ofthe result of splitting a major color table into multiple color tablesis shown in FIG. 7.

FIG. 7 illustrates splitting a major color table into a major colortable and an extended color table in accordance with the first exemplaryembodiments of the disclosure. One technique that can be deployed is tofirst find a nearest number of a n^(th) power for M, note that thisnumber may be smaller than M, and then let the size of the first tableequal to 2^(n-1). In the example of FIG. 7, M=30 as there are 30 colorsrepresented in the major color table 700. For the nearest number ofn^(th) power for 30, n would equal to 4. The size of the first table 701would then equal to 2⁴⁻¹ which would equal to 8. Since the size of thefirst table 701 is 8 which would include all the major colors, the sizeof the extended table 702 would equal to 30−8=22. Therefore, the firstcolor table 701 would cover eight major colors indexed from 0˜7, and thesecond color table 702 would cover 22 colors indexed from 0˜21.

FIG. 8 illustrates a syntax of color palette coding as well as moredetails with regard to the extended color table and the handling ofescape colors in accordance with a second exemplary embodiments of thedisclosure. By applying the concept of FIG. 7 of splitting acomprehensive major color table, a major color table 811 and an extendedcolor table 812 could be derived. For the example of FIG. 8, the majorcolor table 811 has 32 entries while the extended color table has 8entries. The major color table 811 would cover colors that occur mostfrequently from the coding block 810 and include colors such as orange(O), blue (B), navy blue (NB), white (W), brown (Br), and so forth whichcorresponds to indices 0, 1, 2, 3, 4, and so forth. One of the indicesof the major color table 811 does not cover a particular color butactually refer to the extended color table 812. The index that refers tothe extended color table 812 can be any index of the major color table811. For the example of FIG. 8, the index that refers to the extendedcolor table 812 is the last entry or index 31 of the major color table811. In this way, when a encoding of a color from the extended colortable 812 is required, the code would include the last index of themajor color table 811 in order to refer to a color in the extended colortable 812.

The extended color table 812 would include colors that do not appear asfrequently in the coding block 810 as the colors from the major colortable 811. For the example of FIG. 8, the extended color table 812 wouldinclude grey (Gr) that corresponds to index 0, light grey (LG) thatcorresponds to index 1, and so forth. The last entry of the extendedcolor table does not refer to a particular color in the extended colortable 812 but would actually refer to an escape color, which is neithera color from the major color table 811 nor a color from the extendedcolor table 812. For a high resolution still image or a frame of amotion image, various escape colors may occur frequently.

By applying the major color table 811 and the extended color table 812,colors of each pixels from the coding block 810 could be encodedaccording to a specific syntax. For the second exemplary embodiment, theproposed syntax would include not limited to a copy run mode flag 821, amajor color index 822, an extended color index 823, and optionally anoriginal color value 824. As an example, the copy run mode flag 821could be a one binary bit which indicates either a copy left run mode ora copy above run mode. The major color index 822 in the example of FIG.8 would be a 5 bit binary sequence in order to fully cover 32 entries.The extended color index 823 in this example would be a 3 bit binarysequence covering 8 entries. If an escape color needed to be coded, theoptional field of original color value. 824 would be required such thatwhen a decoder decodes upon the entry of escape color (e.g., last entry)of the extended color index 823, the decode may know that the codenecessarily includes the element of an original color value 824.

For example, if a few consecutive row pixels having a color blue (B)needs to be encoded, the syntax may include the copy run mode flag 821bit indicating copy left run mode as well as a binary sequence having avalue that corresponds to index 1 of the major color table (e.g.,00001). For the pixel that has the color grey (Gr) 801 in the codingblock, the syntax may include not limited to a run mode flag 821indicating copy left or copy above, a major color index 822 of a value31 pointing to an extended color, and an extended color index of 1, andthus the syntax could be not limited to ‘0’+‘11111’+‘000’. For the pixel802 that has a rare color (e.g., neon green) not found in neither of thetwo tables, the syntax would contain a copy run mode flag 821 indicatingcopy left or copy above, a binary sequence indicating the last entry ofthe major color index 822, a binary sequence indicating the last entryof the extended color index 823, and a binary sequence indicating anoriginal color value 824 which could be 24 bits as an example.Therefore, for the pixel 802, the syntax could be not limited to‘0’+‘11111’+‘111’+‘10010010 11010000 1010000’.

FIG. 9 illustrates a detailed flow chart of color palette coding inaccordance with the second exemplary embodiments of the disclosure. Instep S901, an encoder (e.g., processor 501) of an electronic device hasstarted to palette encode an image. In step S902, the encoder woulddetermine whether a color of a pixel cannot be found in a(comprehensive) major color table. If a color of a pixel cannot be foundin the major color table, then in step S903, the encoder would encode arun mode flag to be either copy left or copy above. In step S904, theencoder would encode the last entry of the major color table. In stepS905, the encoder would determine whether color of the pixel correspondsto one of the entries of an extended color table. If that is the casethen in step S906, the encoder would also encode the index of theextended color table that corresponds to the color. If in step S905, theencode has determined that the color of the pixel does not correspond toone of the entries of an extended color table, then in step S907, theencoder would encode the last entry of the extended color table. In stepS908, the encoder encode the color according to an original color value(e.g., 24 bits) that corresponds to the color.

If in step S902 the encoder would determine whether a color of a pixelcan be found in a (comprehensive) major color table, then in step S909the encoder would determine whether the copy above mode is to beapplied. If that is the case, then in step S910, the encoder wouldencode the copy run mode flag as copy above as well as encoding a runvalue associated with the copy run mode flag set as copy above. If instep S909, the encoder has determined that the copy left run mode is tobe applied, then in step S912, the encoder would encode the copy runmode flag as copy left. In step S913, the encoder would encode the indexof the major color table and a run value associated with the copy leftrun mode.

FIG. 10 illustrates implementing pixel level alternative escape flag inaccordance with a third exemplary embodiment of the disclosure. Thethird exemplary embodiment is suitable to be used in a high QP or in alow bit rate coding condition in which escape color pixels seldom occur.In other words, the colors of pixels could all be found in a(comprehensive) major color table. Therefore, the disclosure proposes apixel level alternative escape flag. If the flag signals, for example, afirst value which represents activation by either 0 or 1, indices of themajor color table would be used. However, the disclosure does not limitthe pixel level alternative escape flag to 1 bit. If the flag signals asecond value or inactive instead, then indices of the extended colortable would be used. Referring to the example of FIG. 10, to encode acolor grey (Gr) pixel in a coding block such as those labelled as ‘E1’,the pixel level alternative escape flag would be “on” (the first value)since the color grey corresponds to index 0 of the extended color table.Similarly, for encoding a pixel having a color light grey (LG) labelledas ‘E2’ in a coding block, the pixel level alternative escape flag wouldalso be “on” (the first value). For encoding a pixel having a color neongreen (NG) labelled as ‘E5’, the pixel level alternative escape flagwould also be “on” (the first value) since neon green is not one of thecolors in the extended color table.

As for the proposed syntax for encoding, a syntax may include notlimited to a copy run mode flag, the proposed pixel level alternativeescape flag, an extended color index, and optionally an original colorvalue. For the particular example of FIG. 10, the copy run mode flagcould be represented by at least one binary bit, the pixel levelalternative escape flag can be represented by at least one binary bit,the extended color index could be represented by a binary bit sequenceof 3 bits, the original color value can be represented by a binary bitsequence of 24 bits. In this way, the syntax for the pixel 1001 in thecoding block may include not limited to a copy run mode flag set to copyleft, a pixel level alternative escape flag set as ‘on’, and an extendedcolor index which corresponds to index 0 of the extended color table.Therefore, the syntax for the pixel 1001, for example, could be‘0’+‘1’+‘000’. As for the pixel 1002, the syntax would additionallyrequire the original color value of the color escape color such as neongreen as the extended color index would corresponds to the last index orindex 7 of the extended color table. Therefore, the syntax for the pixel1002, for example, could be ‘0’+‘1’+‘111’+‘10010010 11010000 1010000’.

FIG. 11 illustrates a detailed flow chart of implementing pixel levelalternative escape flag in accordance with one of the exemplaryembodiments of the disclosure. In step S1101, an encoder (e.g.,processor 501) of an electronic device has started to palette encode animage. In step S1102, the encoder would determine whether a color of apixel cannot be found in a (comprehensive) major color table but alsocannot be found in an extended color table. In other words, the pixel inthis example would have an escape color. Since that is the case, then instep S1103, the encoder would encode a run mode flag to be either copyleft. In step S1104, the encoder would encode the pixel levelalternative escape flag as ‘on’ which could be represented by a binarybit value of either 0 or 1. In step S1105, the encoder would encode thelast index of an extended color table. If that is the case then in stepS1106, the encoder would also encode the original color value of theescape color. If in step S1102, the encoder has determined that thecolor of the pixel cannot be found in a (comprehensive) major colortable but can instead be found in an extended color table, then encoderwould determine whether to encode copy above mode. If copy above mode isto be encoded, then in step S1108, the encoder would set the copy runmode flag as copy above. In step S1108, the encoder would set a runvalue associated with the copy above mode. If in step S1101 the encoderhas determined that the copy left mode is to be encoded, then in stepS1110, the encoder would set the copy run mode flag as copy left. Instep S1111, the encoder would need to determine whether to set the pixellevel alternative escape flag as ‘on’. If that is the case, then in stepS1112, the encoder would encode the index of the extended color tablewhich corresponds to one of the colors that matches the color of thepixel to be encoded. If in step S1111, the encoder has determined to setthe pixel level alternative escape flag as ‘off’, then in step S1113,the encoder would encode the index of the major color table whichcorresponds to one of the colors that matches the color of the pixel tobe encoded. Step S1113 would signify that the color to be encoded can befound in a major color table.

FIG. 12A illustrates an alternative embodiment of operating with pixellevel alternative escape flag in accordance with a fourth exemplaryembodiment of the disclosure. For this exemplary embodiment, thesignaling of the escape color pixel would be moved from the copy leftmode to copy above mode only when a pixel to be encoded is an escapecolor. A pixel level alternative escape flag is used to indicate whethera pixel is an escape color or in a copy above mode. If the color to beencoded is an escape color, then the syntax would include not limited toa copy above run mode flag+pixel level alternative flag (e.g., set as“1”)+original color value for the escape color. If the color to beencoded is not an escape color, then the syntax would include notlimited to a copy above run mode flag+a pixel level alternative escapeflag (e.g., set as “0”)+a run value associated with the copy above mode.

Referring to FIG. 12A, for pixel 1201 which is an escape color,conventionally this pixel would be encoded by a syntax that includes acopy run mode flag represented by at least one bit, a bit streamrepresenting the last entry of a major color table, and a bit streamrepresenting the original color value of the escape color (e.g.,‘0’+‘11111’+‘11111111 1111111 1111111’). However, for the fourthexemplary embodiment, the syntax would include a copy run mode flagrepresented by at least one bit, a pixel level alternative escape flagwhich is most likely one bit instead of a bit stream, and a bit streamrepresenting the original color value of the escape color (e.g.,‘1’+‘1’+‘11111111 1111111 1111111’). In this way, overheads can bereduced since using the pixel level alternative escape flag requiresless number of bits than the bit stream representing the last entry of amajor color table.

FIG. 12B illustrates an example of operating with pixel levelalternative escape flag in accordance with a fourth exemplary embodimentof the disclosure. For this example, the conventional copy above moderun flag could be replaced by adding a flag after the run mode flag toindicate which color table is used (e.g., ‘1’+‘0’+‘0’). This proposedflag can be represented in a conventional way (e.g., fixed length binaryrepresentation) or by variable length coding to address the frequency orthe importance of the color tables. For example, colors inside the majorcolor table may occur more frequently than colors in the extended colortables or escape colors. Therefore, the proposed flag could be coded byHuffman code, exponential-Golomb code, or Golomb-Rice coding methods.Referring to the colors represented in the extended color tables, apixel could be encoded by a syntax that includes a copy run mode flagrepresented by at least one bit, a bit stream to indicate what extendedcolor table is referred to, and a bit stream representing the originalcolor value of the escape color.

For example, the pixel 1211 could be represented at least by‘1’+‘10’+‘000’. When encoding an escape color, an encoded syntax couldinclude a copy run mode flag represented by at least one bit, a bitstream representing which extended color table are indicated, and a bitstream representing the original color value of the escape color. Forexample, the pixel 1212 could be represented at least by‘1’+‘11’+‘11111111 1111111 1111111’.

If the decoder that decodes the above bit stream parses the syntax anddetermine that this is copy above run mode, the decoder will then decodethe flag. As mentioned in the example above, the decoded flag is ‘0’,and thus the decoder decode the following syntax as copy above runvalue. If the decoded flag is ‘10’, the decoder decodes the next streamas the indices of the extended color table. Otherwise, if the decodedflag is ‘11’, it indicates that the decoder need to decode escapevalues.

FIG. 13 illustrates representing escape colors in alternative manners inaccordance with a fifth exemplary embodiment of the disclosure. Thefifth exemplary embodiment is suitable to be used under the circumstancewhen the copy-above mode with run value zero very rarely occurs.Therefore, it is proposed that the signaling for escape color encodingis moved from the copy left run mode in a conventional to the copy aboverun mode in the proposed design. The encoding for an escape color wouldbe similar to the third exemplary embodiment as the syntax for an escapecolor would include not limited to at least one bit representing thecopy mode run flag which is set as copy above mode+one bit representinga run value associated with the copy above mode but set as ‘0’+a bitstream representing an original color value of the escape color to beencoded. The copy above run value would start from 1, and theconventional copy above mode+a run value “0” would be replaced by thecopy run mode flag set as copy left along with the palette indexsimplification of the third exemplary embodiment without the pixel levelalternative escape flag.

Referring to the examples of FIG. 13 which may require only a majorcolor table 1304 without other tables as the last index of the majorcolor table 1304 refers to a specific color rather than another set oftable. Assuming that the pixel 1301 and the pixel 1303 are escape colorsand are identical, the syntax would include not limited to a copy runmode flag set as copy above, a one bit run value which could be set aszero, and an original color value of the escape color. Therefore, thesyntax could be, for example, ‘1’+‘0’+‘1111111 1111111 1111111’. For thepixel 1302 which is the same color as the pixel below, the syntax mayonly include a one bit a run mode flag set as copy above and a one bitrun value associated with the copy above mode.

FIG. 14 illustrates an example of the fifth exemplary embodiment of thedisclosure. For the major color table 1406, the last index 1406 for anescape is not required. For pixel 1401 which is an escape color, thesyntax for a conventional coding system could be a copy run modeflag+the last index of the major color table+an original color value ofthe escape color (e.g., ‘0’+‘11111’+1111111 1111111 1111111′). However,the proposed syntax as disclosed above could be not limited to a copyrun mode flag set as copy above, a one bit run value which could be setas zero, and an original color value of the escape color, and thus thesyntax could be, for example, ‘1’+‘0’+‘1111111 1111111 1111111’. As forthe pixel 1402 which is orange color corresponding to index 0 of themajor color table 1405, the pixel would be encoded by an one bit a runmode flag set as copy above and an one bit run value associated with thecopy above mode and an index corresponding to the color orange in themajor color table 1405; thus, the syntax could be, for example,‘1’+‘00000’+‘0’.

As for a sixth exemplary embodiment, it is suitable to be used whenescape color pixels very rarely occur such as in high QP or low bit ratecoding condition in which escape color pixels rarely occur. Therefore, acoding unit level alternative escape flag is proposed. When the codingunit level alternative escape flag is set as inactive, then aconventional coding scheme would be used. This means that the last indexin a comprehensive major color table would refer to an escape color, asidentical to a current SCM software. Only when the coding unit levelalternative escape flag is set as active, any of the embodiments of theproposed methods color palette coding would be used.

FIG. 15 is a comprehensive flow chart illustrating the procedures of thefourth, fifth, and sixth exemplary embodiment of the disclosure. In stepS1501, an encoder (e.g., processor) may determine whether a coding unitlevel alternative escape color flag to be set as active. If theconventional palette coding mechanism is to be used, then the codingunit level alternative escape color flag would be set as inactive. Inthat case, steps S1515˜S1522 would be executed. Since the mechanisms ofsteps S1515˜S1522 are conventional and are self-explanatory in thedrawing, a repetition of the written descriptions is not necessary. Ifthe proposed method of color palette coding and any of their exemplaryembodiments is to be used as stated in step S1502, then the coding unitlevel alternative escape color flag would be set as active in stepS1501.

In step S1503, the encoder would deter line whether the color of a pixelto be encoded is an escape color. If the color of the pixel to beencoded is an escape color, then in step S1504, the encoder would encodea copy run mode flag set as copy above. In step S1505, the encoder wouldencode a run value associated with the copy above copy run mode flag. Instep S1506, the encoder may encode an original color value of the escapecolor. In step S1507, the encoder may perform an escape color pixelprediction which will be described in the eighth exemplary embodiment.

If the color of the pixel to be encoded is not an escape color back instep S1503, then in step S1508, the encoder would determine whether copyabove mode would be set for the copy run mode flag. If the copy run modeflag is to be set as copy above, then in step S1509, the encoder wouldset the copy run mode flag as copy above. In step S1510, the encoderwould encode a run value associated with the copy above copy run modeflag. If in step the encoder has determined that copy left mode would beset for the copy run mode flag, then in step S1511, the encoder wouldset the copy left mode for the copy run mode flag. In step S1512, theencoder would transmit an index of a major color table and a run valueassociated with the color to be encoded.

FIG. 16 illustrates using a combination of an extended color table withan alternative implementation of representing escape colors inaccordance with the seventh exemplary embodiment of the disclosure. Theseventh exemplary embodiment is premise upon the second and fifthexemplary embodiment by combining an extended color table with analternative escape color pixel flag in order to represent an escapecolor. The syntax of the seventh exemplary embodiment to represent anescape color would include not limited to an one bit copy run mode flagset as copy above, an one bit run value associated with the copy abovemode, a binary sequence (e.g., 3 bits) which represents the last indexof the extended color table, and a binary sequence (e.g., 24 bits) thatincludes the original color value of the escape color to be represented.By following the rule of the syntax above, assuming that the pixel 1601is the color grey (Gr) which corresponds to index 0 (e.g., 000) of theextended color table, the syntax for the pixel 1601 could be‘1’+‘0’+‘000’. For the pixel 1602 which is an escape color not coveredby the major color table nor the extended color table, the syntax couldbe ‘1’+‘0’+‘111’+‘10010010 1101000 1010000’.

FIG. 17 is a flow chart which illustrates the procedure of the seventhexemplary embodiment of the disclosure. In step S1701, the encodercommences the proposed method of color palette encoding. In step S1702,the encoder would determine whether a color to be encoded does notappear in a (comprehensive) major color table. In step S1703, theencoder would encode the copy run mode flag set as copy above mode and arun value associated with the copy above mode as shown in step S1704. Instep S1705, the encoder would determine whether the color to be encodedis inside of an extended color table. If the color is inside of anextended color table, then in step S1706, the encoder would transmit anindex of the extended color table. If the color is not inside of anextended color table, then in step S1707, the encoder would transmit thelast index of the extended color table. In step s 1708, the encoderwould transmit an original color value of the escape color to beencoded.

If in step S1702 the encoded has determined that the color of the pixelto be encoded in found in a (comprehensive) major color table, then instep S1709, the encoder would determine whether the copy run mode flagwould be set as copy above. If the copy run mode flag would be set ascopy above mode, the in step S1710, the encoder would encode the copyrun mode flag which is set as copy above mode. In step S1711, theencoder would encode a run value associated with the copy above mode. Ifthe copy run mode flag is determined to be set as copy left mode, thenin step S1712, the encoder would encode the copy run mode flag which isset as copy left mode. In step S1713, the encoder would encode the indexof a major color table as well as a run value associated with the copyleft mode.

FIG. 18 illustrates escape color pixel prediction in accordance with theeighth exemplary embodiment of the disclosure. The eighth exemplaryembodiment would involve representing an escape color of a pixel byreferencing a neighboring pixel and encoding a difference of colorsbetween the pixel having the escaping color and the neighboring pixel.To generate major color table in a lossless coding scheme, it requiresthree components of color samples to be identical in order to group themtogether. Since many color samples could just be slightly different frommajor colors, neighboring pixel or the last coded escape color pixelscould be referenced to represent an escape color. Predictors could beused to predict the current escape color pixel. A coding syntax mayinclude the differences as well as a sigh bit between two neighboringpixels.

To referring to the example of FIG. 18, a syntax to represent a colormay include not limited to an one bit a copy run mode flag+an one bitrun value associated with the copy run mode flag, an index of anextended color table (e.g., 3 bits), an one bit signed bit, and adifference color value which can have a variable bit value. For example,the color of the pixel 1801 is grey which corresponds to index 0 of theextended color table. Therefore, the syntax would include not limited tothe copy run mode flag+run value associated with the copy run modeflag+extended color index which is ‘1’+‘0’+‘000’. For the pixel 1802,since it is an escape color not covered by the extended color table, thesyntax would include a copy above run mode flag+run value of the copyabove mode+last index of the extended color table+signed bit+variablelength bits which is the difference between the escape color and thecolor of a neighboring color such as the color of the pixel on the leftof the pixel 1802. Therefore, the syntax could be ‘1’+‘0’+‘111’+‘signedbit’+‘variable length bits’.

FIG. 19 illustrates a decoding process of a coded syntax in accordancewith one of the exemplary embodiments of the disclosure. In step S1901,when a decoder receiving a syntax such as the one shown in the FIG. 8for example, the decoder would decode the copy run mode flag 821 atfirst. If the copy run mode flag 821 is decoded to be a first value suchas (“on”, or “1”), it indicates that the copy run mode is the copy aboverun mode. Otherwise, if a second value is decoded, the copy run modeflag 821 would indicate that it is copy left run mode. If the flag 821indicates copy run above run mode, the in step S1902, the decoder woulddecode a next syntax or a following bit stream for run value. Thedecoder would then copy numbers of the indices above the currentposition according to the run value. Otherwise, if the flag 821 isdecoded as a second value such as ‘off’ or zero, in step S1903 thedecoder will then decode the next syntax to determine the major colorindex. If the number of the decoded indices of the major color index isthe last entry, as shown as 822, then in step S1904 the decoder wouldcontinue to decode the next syntax for the extended color index. If theextended color index is determined to be the last index of the extendedcolor table, then in step S1905 the decoder would the following syntaxas escape values; otherwise in step S1906 the decode would then decodethe run value. If in step S1903 the index of the major color index tableis not the last entry, then the decoder would decode the run value.

In view of the aforementioned descriptions, the present disclosure issuitable for being used by any electronic device which performs imagecompression that results in a reduction of the amount of bits requiredto represent an image by as much as 1%.

No element, act, or instruction used in the detailed description ofdisclosed embodiments of the present application should be construed asabsolutely critical or essential to the present disclosure unlessexplicitly described as such. Also, as used herein, each of theindefinite articles “a” and “an” could include more than one item. Ifonly one item is intended, the terms “a single” or similar languageswould be used. Furthermore, the terms “any of” followed by a listing ofa plurality of items and/or a plurality of categories of items, as usedherein, are intended to include “any of”, “any combination of”, “anymultiple of”, and/or “any combination of multiples of the items and/orthe categories of items, individually or in conjunction with other itemsand/or other categories of items. Further, as used herein, the term“set” is intended to include any number of items, including zero.Further, as used herein, the term “number” is intended to include anynumber, including zero.

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the structure of thedisclosed embodiments without departing from the scope or spirit of thedisclosure. In view of the foregoing, it is intended that the disclosurecover modifications and variations of this disclosure provided they fallwithin the scope of the following claims and their equivalents.

What is claimed is:
 1. A method of color palette for implementing abinary representation of a color applicable to an electronic device, themethod comprising: encoding, by using a processor, a bit stream torepresent a color of a coding unit, wherein the bit stream comprises: abinary bit representing a run flag; a N binary bit sequence representingup to 2^(N) major colors in a coding unit with each of the possiblevalues of the N binary bit sequence representing an unique major colorindex of N major color indices; and a M binary bit sequence representingup to 2^(M) extended colors which are not the major colors and appearsless frequently than the major colors in the coding unit with each ofthe possible values of the M binary bit sequence representing an uniqueextended color index of M extended color indices; encoding, by using theprocessor, a second bit stream to represent a color of a second codingunit, wherein the second bit stream comprises: a second binary bitrepresenting a second run flag; a pixel level alternative escape flag; asecond M binary bit sequence representing up to 2^(M) extended colors;and a second original color value to represent an escape color of thesecond coding unit; and storing the bit stream and the second bit streamin a storage medium to be decoded and displayed or transmitting the bitstream and the second bit stream to a video driver to be decoded anddisplayed.
 2. The method of claim 1, wherein when the pixel levelalternative escape flag is a first value, the color of the second codingunit is represented by the N major color indices, and when the pixellevel alternative escape flag is a second value, the color of the secondcoding unit is represented by the M extended color indices.
 3. Themethod of claim 2, wherein only when the pixel level alternative escapeflag is active, the run flag indicates the copy above mode, the pixellevel alternative escape flag indicates the first value.
 4. The methodof claim 3 further comprising: encoding, by using the processor, a thirdbit stream to represent a color of a third coding unit, and wherein ifthe color of the third coding unit is a third escape color, the thirdbit stream comprises: a third binary bit indicating the copy above mode;a pixel level alternative escape flag set to active; and a thirdoriginal color value to represent the third escape color.
 5. The methodof claim 4, wherein if the color of the third coding unit is not thethird escape color, claim 5 further comprising: the third binary bitindicating the copy above mode; the pixel level alternative escape flagset to inactive; and a copy above run value associated with the copyabove mode.
 6. The method of claim 1 further comprising: encoding, byusing the processor, a fifth bit stream to represent a color of a fifthcoding unit and comprises a pixel level alternative escape flag, whereinif the pixel level alternative escape flag is set as inactive, the fifthbit stream further comprises a third N binary bit sequence representingup to 2^(N) major colors in a coding unit with each of the possiblevalues of the N binary bit sequence representing an unique major colorindex of N major color indices except for a last index indicating anescape color.
 7. The method of claim 6, wherein if the pixel levelalternative escape flag is set as active, the last index indicates oneof the major colors.
 8. The method of claim 7, wherein if the pixellevel alternative escape flag is set as active, the last index refers toone of the extended colors.